package com.quectel.core.module.dept.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author caolu
 * @email louis.cao@quectel.com
 * @date 2022/03/24 10:07
 */
@Data
@Schema
public class DeptPersonDto implements Serializable {

    /**
     *
     */
    @Schema(description = "")
    private Long id;

    /**
     * 租户id
     */
    @Schema(description = "租户id")
    private Long tenantId;

    /**
     * 小区id
     */
    @Schema(description = "小区id")
    @NotNull
    private Long villageId;

    /**
     * 部门
     */
    @Schema(description = "部门")
    @NotNull
    private Long deptId;

    /**
     * 是否管理员1是0否
     */
    @Schema(description = "是否管理员1是0否")
    @NotNull
    private Byte isAdmin;

    /**
     * 工号
     */
    @Schema(description = "工号")
    @Length(max = 50)
    private String jobNo;

    /**
     * 头像
     */
    @Schema(description = "头像url")
    private String avatar;

    /**
     * 头像
     */
    @Schema(description = "昵称")
    @Length(max = 80)
    private String nickname;

    /**
     * 姓名
     */
    @Schema(description = "姓名")
    @NotEmpty
    @Length(min = 1, max = 50)
    private String name;

    /**
     * 手机号
     */
    @Schema(description = "手机号")
    @Length(min = 1, max = 20)
    private String mobile;

    /**
     * 加密后的密码 BCrypt加密
     */
    @Schema(description = "加密后的密码 BCrypt加密")
    @JsonIgnore
    private String password;

    /**
     * 性别1男0女
     */
    @Schema(description = "性别1男0女")
    @NotNull
    private Byte gender;

    /**
     * 入职日期
     */
    @Schema(description = "入职日期")
    @NotNull
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date joinedDate;

    /**
     * 首次参加工作日期
     */
    @Schema(description = "首次参加工作日期")
    @NotNull
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date firstJobDate;

    /**
     * 人脸照片
     */
    @Schema(description = "人脸照片")
    private String faceImg;

    /**
     * 证件类型1身份证
     */
    @Schema(description = "证件类型1身份证")
    private Byte cardType;
    /**
     * 证件号
     */
    @Schema(description = "证件号")
    private String cardNo;

    /**
     * 证件照片
     */
    @Schema(description = "证件照片")
    private String cardImg;

    /**
     * 岗位
     */
    @Schema(description = "岗位")
    private String post;

    /**
     * 邮箱
     */
    @Schema(description = "邮箱")
    private String email;

    /**
     * 扩展字段
     */
    @Schema(description = "扩展字段")
    private String extraAttr;

    /**
     * 1启用2禁用
     */
    @Schema(description = "1启用0禁用")
    @NotNull
    private Byte status;

    /**
     *
     */
    @Schema(description = "")
    private String creator;

    /**
     *
     */
    @Schema(description = "")
    private Date createTime;

    /**
     *
     */
    @Schema(description = "")
    private String editor;

    /**
     *
     */
    @Schema(description = "")
    private Date editTime;

    /************非数据库字段 start ************/
    @Schema(description = "部门")
    private DeptDto dept;
    @Schema(description = "小区名称")
    private String villageName;


    @Schema(description = "员工与角色关系列表")
    private List<DeptPersonRoleDto> deptPersonRoleDtos;

    /************非数据库字段 end **************/
}
